import os
# 1、路径拼接
new_path = os.path.join("a", "b")
print(new_path)
new_path = os.path.join("a", "b", "test.py")
print(new_path)
new_path = os.path.join("../day2", "model", "test.txt")
print(new_path)
#路径分割
path = "../day2/model/test.JPG"
print(f"最后一级路径前所有路径{os.path.dirname(path)}")
print(f"最后一级路径{os.path.basename(path)}")

file_name = os.path.basename(path)
file_name,filesuf = os.path.splitext(file_name)
print(file_name,filesuf)
if filesuf.lower() ==".jpg":
    print("你上传的是jpg文件可以进行图像处理")
    print(f"检查文件是否存在：{os.path.isfile('../images/02.png')}")
    print(f"检查目录是否存在：{os.path.isdir('../day2')}")
    print(f"检查路径是否存在：{os.path.exists('../day2/test')}")
#os.rename("a.py","test.py")
#os.remove("test.py")